// Author: wsfuyibing <682805@qq.com>
// Date: 2025-05-14

package kind

import "fmt"

// ArcadeAdminOperation
// 钓场管理员操作类型.
type ArcadeAdminOperation int

const (
	ArcadeAdminOperationUpdateArcadeName    ArcadeAdminOperation = 1001
	ArcadeAdminOperationUpdateArcadeAddress ArcadeAdminOperation = 1002

	ArcadeAdminOperationSwiperCreate ArcadeAdminOperation = 1101
	ArcadeAdminOperationSwiperUpdate ArcadeAdminOperation = 1102
	ArcadeAdminOperationSwiperDelete ArcadeAdminOperation = 1103

	ArcadeAdminOperationPondCreate ArcadeAdminOperation = 1201
	ArcadeAdminOperationPondUpdate ArcadeAdminOperation = 1202
	ArcadeAdminOperationPondDelete ArcadeAdminOperation = 1203

	ArcadeAdminOperationSeatRename   ArcadeAdminOperation = 1301
	ArcadeAdminOperationSeatRemove   ArcadeAdminOperation = 1302
	ArcadeAdminOperationSeatCreate   ArcadeAdminOperation = 1303
	ArcadeAdminOperationSeatSwitcher ArcadeAdminOperation = 1304

	ArcadeAdminOperationMemberSwitcher ArcadeAdminOperation = 1401
	ArcadeAdminOperationMemberSetting  ArcadeAdminOperation = 1402

	ArcadeAdminOperationShopSwitcher       ArcadeAdminOperation = 1501
	ArcadeAdminOperationShopDistance       ArcadeAdminOperation = 1502
	ArcadeAdminOperationShopCategoryCreate ArcadeAdminOperation = 1503
	ArcadeAdminOperationShopCategoryUpdate ArcadeAdminOperation = 1504
	ArcadeAdminOperationShopCategoryDelete ArcadeAdminOperation = 1505

	ArcadeAdminOperationShopGoodsCreate         ArcadeAdminOperation = 1601
	ArcadeAdminOperationShopGoodsUpdate         ArcadeAdminOperation = 1602
	ArcadeAdminOperationShopGoodsDelete         ArcadeAdminOperation = 1603
	ArcadeAdminOperationShopGoodsSwitcher       ArcadeAdminOperation = 1604
	ArcadeAdminOperationShopGoodsPurchaseAdd    ArcadeAdminOperation = 1605
	ArcadeAdminOperationShopGoodsPurchaseLock   ArcadeAdminOperation = 1606
	ArcadeAdminOperationShopGoodsPurchaseRemove ArcadeAdminOperation = 1607

	ArcadeAdminOperationTicketRecordStart      ArcadeAdminOperation = 1701
	ArcadeAdminOperationTicketRecordStop       ArcadeAdminOperation = 1702
	ArcadeAdminOperationTicketRecordReturnFish ArcadeAdminOperation = 1703
	ArcadeAdminOperationTicketRecordChooseTime ArcadeAdminOperation = 1704
	ArcadeAdminOperationTicketRecordChooseSeat ArcadeAdminOperation = 1705
)

var (
	arcadeAdminOperationTexts = map[ArcadeAdminOperation]string{
		ArcadeAdminOperationUpdateArcadeName:    "修改钓场名称",
		ArcadeAdminOperationUpdateArcadeAddress: "修改钓场地址",

		ArcadeAdminOperationSwiperCreate: "添加轮播图",
		ArcadeAdminOperationSwiperUpdate: "修改轮播图",
		ArcadeAdminOperationSwiperDelete: "删除轮播图",

		ArcadeAdminOperationPondCreate: "添加鱼塘",
		ArcadeAdminOperationPondUpdate: "修改鱼塘",
		ArcadeAdminOperationPondDelete: "删除鱼塘",

		ArcadeAdminOperationSeatRename:   "钓位改名",
		ArcadeAdminOperationSeatRemove:   "删除钓位",
		ArcadeAdminOperationSeatCreate:   "新增钓位",
		ArcadeAdminOperationSeatSwitcher: "切换状态",

		ArcadeAdminOperationMemberSwitcher: "钓场会员开关",
		ArcadeAdminOperationMemberSetting:  "钓场会员设置",

		ArcadeAdminOperationShopSwitcher: "商店开关",
		ArcadeAdminOperationShopDistance: "商店可售范围",

		ArcadeAdminOperationShopCategoryCreate: "添加分类",
		ArcadeAdminOperationShopCategoryUpdate: "更新分类",
		ArcadeAdminOperationShopCategoryDelete: "删除分类",

		ArcadeAdminOperationShopGoodsCreate:         "添加商品",
		ArcadeAdminOperationShopGoodsUpdate:         "更新商品",
		ArcadeAdminOperationShopGoodsDelete:         "删除商品",
		ArcadeAdminOperationShopGoodsSwitcher:       "商品上下架",
		ArcadeAdminOperationShopGoodsPurchaseAdd:    "添加采购",
		ArcadeAdminOperationShopGoodsPurchaseLock:   "冻结库存",
		ArcadeAdminOperationShopGoodsPurchaseRemove: "删除采购",

		ArcadeAdminOperationTicketRecordStart:      "作钓开始",
		ArcadeAdminOperationTicketRecordStop:       "作钓结束",
		ArcadeAdminOperationTicketRecordReturnFish: "回鱼",
		ArcadeAdminOperationTicketRecordChooseTime: "设置作钓时间",
		ArcadeAdminOperationTicketRecordChooseSeat: "设置钓位",
	}
	arcadeAdminOperationUnknownText = "未知"

	// arcadeAdminOperationPages
	// 小程序详情页名称.
	arcadeAdminOperationPages = map[ArcadeAdminOperation]string{
		ArcadeAdminOperationShopGoodsPurchaseAdd:   "me.master.shop.stock",
		ArcadeAdminOperationTicketRecordReturnFish: "me.master.ticket.record.return.fish",
		ArcadeAdminOperationTicketRecordChooseTime: "me.master.ticket.record.choose.time",
		ArcadeAdminOperationTicketRecordChooseSeat: "me.master.ticket.record.choose.seat",
	}
	arcadeAdminOperationPageUndefined = ""
)

func (o ArcadeAdminOperation) Page() string {
	if str, ok := arcadeAdminOperationPages[o]; ok {
		return str
	}
	return arcadeAdminOperationPageUndefined
}

func (o ArcadeAdminOperation) Text() string {
	if str, ok := arcadeAdminOperationTexts[o]; ok {
		return str
	}
	return arcadeAdminOperationUnknownText
}

// 钓场日志

func (o ArcadeAdminOperation) ToUpdateArcadeAddress(before, after string) string {
	return fmt.Sprintf(`钓场地址从[%s]改为[%s]`, before, after)
}

func (o ArcadeAdminOperation) ToUpdateArcadeName(before, after string) string {
	return fmt.Sprintf(`钓场名称从[%s]改为[%s]`, before, after)
}

// 轮播图日志

func (o ArcadeAdminOperation) ToSwiperCreate(title string, state Enabled) string {
	return fmt.Sprintf(`轮播图[%s]已新增, 状态为[%s]`, title, state.Text())
}

func (o ArcadeAdminOperation) ToSwiperUpdate(before, after string, state Enabled) string {
	return fmt.Sprintf(`轮播图[%s]已变更为[%s], 状态为[%s]`, before, after, state.Text())
}

func (o ArcadeAdminOperation) ToSwiperDelete(title string, state Enabled) string {
	return fmt.Sprintf(`轮播图[%s]已删除, 状态为[%s]`, title, state.Text())
}

// 鱼塘日志

func (o ArcadeAdminOperation) ToPondCreate(pond, content string) string {
	return fmt.Sprintf(`[%s]已新, %s`, pond, content)
}

func (o ArcadeAdminOperation) ToPondUpdate(pond, content string) string {
	return fmt.Sprintf(`[%s]变更, %s`, pond, content)
}

func (o ArcadeAdminOperation) ToPondDelete(pond, content string) string {
	return fmt.Sprintf(`[%s]已删除, %s`, pond, content)
}

// 钓位日志

func (o ArcadeAdminOperation) ToSeatRename(pond, before, after string) string {
	return fmt.Sprintf(`[%s]的钓位[%s]改名成[%s]`, pond, before, after)
}

func (o ArcadeAdminOperation) ToSeatRemove(pond, name string) string {
	return fmt.Sprintf(`[%s]的钓位[%s]已删除`, pond, name)
}

func (o ArcadeAdminOperation) ToSeatCreate(pond string, count int) string {
	return fmt.Sprintf(`[%s]新增了[%d]个钓位`, pond, count)
}

func (o ArcadeAdminOperation) ToSeatSwitcher(pond, seat string, state Enabled) string {
	return fmt.Sprintf(`[%s]的钓位[%s]状态切换为[%s]`, pond, seat, state.Text())
}

// 钓场会员

func (o ArcadeAdminOperation) ToMemberSwitcher(state Enabled) string {
	return fmt.Sprintf(`钓场会员状态切换为[%s]`, state.Text())
}

func (o ArcadeAdminOperation) ToMemberSetting(content string) string {
	return fmt.Sprintf(`设置会员特权 %s`, content)
}

// 钓场商店

func (o ArcadeAdminOperation) ToShopSwitcher(state Enabled) string {
	return fmt.Sprintf(`钓场商店状态切换为[%s]`, state.Text())
}

func (o ArcadeAdminOperation) ToShopDistance(before, after int) string {
	return fmt.Sprintf(`钓场可售范围从[%d]米改到[%d]米`, before, after)
}

// 钓场商品分类

// ToShopGoods
// 商品信息.
//
//	return "商品 红牛 的状态 在售中, 售价 5.50 元/罐, 库存 15 罐"
func (o ArcadeAdminOperation) ToShopGoods(name string, state GoodsState, price Balance, stock GoodsStock, unit GoodsUnit) string {
	return fmt.Sprintf(`商品 %s 的状态 %s, 售价 %.02f 元/%s, 库存 %d %s`,
		name,
		state.Text(),
		price,
		unit.Text(),
		stock,
		unit.Text(),
	)
}

func (o ArcadeAdminOperation) ToShopCategoryCreate(content string) string {
	return fmt.Sprintf(`新增商品分类 - %s`, content)
}

func (o ArcadeAdminOperation) ToShopCategoryUpdate(content string) string {
	return fmt.Sprintf(`更新商品分类 - %s`, content)
}

func (o ArcadeAdminOperation) ToShopCategoryDelete(content string) string {
	return fmt.Sprintf(`删除商品分类 - %s`, content)
}

func (o ArcadeAdminOperation) ToShopGoodsCreate(content string) string {
	return fmt.Sprintf(`新增商品 - %s`, content)
}

func (o ArcadeAdminOperation) ToShopGoodsUpdate(content string) string {
	return fmt.Sprintf(`更新商品 - %s`, content)
}

func (o ArcadeAdminOperation) ToShopGoodsDelete(content string) string {
	return fmt.Sprintf(`删除商品 - %s`, content)
}

func (o ArcadeAdminOperation) ToShopGoodsPurchaseAdd(content string) string {
	return fmt.Sprintf(`新增采购 - %s`, content)
}

func (o ArcadeAdminOperation) ToShopGoodsPurchaseLock(content string) string {
	return fmt.Sprintf(`冻结库存 - %s`, content)
}

func (o ArcadeAdminOperation) ToShopGoodsPurchaseRemove(content string) string {
	return fmt.Sprintf(`删除采购 - %s`, content)
}

// 操作购票记录.
